<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<div></div>
</body>
<script>
  var div = document.querySelector('div');
  var date = new Date();
  var nowHour = date.getHours();

  if(nowHour < 12){
    div.innerHTML = '早上好';
  } else if (nowHour === 12){
    div.innerHTML = '中午好';
  } else {
    div.innerHTML = '晚上好';
  }
</script>
</html>